package thong.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.jstl.sql.Result;

import thong.util.JdbcUtil;

/**
 * Servlet implementation class MenuCategoriesServlet
 */
@WebServlet("/MenuCate.do")
public class MenuCategoriesServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public MenuCategoriesServlet() {
        super();
        // TODO Auto-generated constructor stub
    }



	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");

		
        String searchSql = "SELECT * FROM Categories";
        Result Menucas = JdbcUtil.toResult(searchSql);
        request.setAttribute("Menucas", Menucas);
        /*
         * Chuyển tiếp sang trang Product.jsp
         */
        request.getRequestDispatcher("pages/Template.jsp").forward(request, response);
	}

}
